//
//  GlobalConfig.h
//  NewTaiPing
//
//  Created by StarZhang on 4/4/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

//#import "AppDelegate.h"

//
//  Global.h
//  OrderPhone
//
//  Created by 汪兴 on 12-11-8.
//  Copyright (c) 2012年 汪兴. All rights reserved.
//
#import <UIKit/UIKit.h>
#ifndef OrderPhone_Global_h
#define OrderPhone_Global_h

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

//.storyboard
#define STORYBOARD_NAME (IS_IPAD? @"Main_iPad": @"Main_iPhone")

#define SCALE_6S_W SCREEN_WIDTH/375 // 以6s为模板 设适配比例
#define SCREEN_BOUNDS [[UIScreen mainScreen] bounds]                       //屏幕尺寸
#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width             //屏幕宽度
#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height           //屏幕高度
#define SCREEN_BARHEIGHT self.navigationController.navigationBar.frame.size.height+20 //屏幕Bar高
#define SCREEN_TABBATHEIGHT

#define MEMBER_MESSAGE @"postMyMemberMessages"
#define OFFER_MESSAGE @"postMyOfferMessages"
#define TICKETE_TMESSAGE @"postMyTicketMessages"

/**
 * @brief iPhoneVersion
 */
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone4s ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone5s ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

#define kDevice_Is_iPhoneX \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

#define IPX_STATUSBAROFFSETHEIGHT   ((kDevice_Is_iPhoneX) ? 24.0 : 0.0)
#define IPX_HOMEINDICATORHEIGHT     ((kDevice_Is_iPhoneX) ? 34.0 : 0.0)

#define SAFE_AREA_TOP [[UIApplication sharedApplication] delegate].window.safeAreaInsets.top
#define SAFE_AREA_BOTTOM [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom

#define STATUSBARHEIGHT         (20.0 + IPX_STATUSBAROFFSETHEIGHT)
#define NAVIBARHEIGHT           44.0
#define tabBarItemHeight            ((kDevice_Is_iPhoneX) ? 83.0 : 49.0)


/**
 * @brief iOS System Version
 */
#define iOSVersion ([[[UIDevice currentDevice] systemVersion] floatValue]) // iOS系统版本

/**
 * iOS9Upwards 表示 iOS9以上, 则 !iOS9Upwards 表示iOS9以下
 */
// iOS7 以上
#define iOS7Upwards (iOSVersion >= 7.0)
// iOS8 以上
#define iOS8Upwards (iOSVersion >= 8.0)
// iOS9 以上 iOS9Upwards == @available(iOS 9.0, *)
#define iOS9Upwards (iOSVersion >= 9.0)
//#define iOS9Upwards @available(iOS 9.0, *)
// iOS10 以上 iOS10Upwards
#define iOS10Upwards (iOSVersion >= 10.0)
// iOS11 以上 iOS11Upwards
#define iOS11Upwards (iOSVersion >= 11.0)


//判断设备系统
#define  DEVICE_SYSTEM_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]


//   千分号
#define PERSENT @"‰"

//Iphone&Ipad 的键盘高度
//Iphone  横屏
#define IPHONE_LANDSCAPE_KEYBOARD_HEIGHT 140+50
//Iphone  竖屏
#define IPHONE_PORTRAIT_KEYBOARD_HEIGHT 266
//Ipad  横屏
#define IPAD_LANDSCAPE_KEYBOARD_HEIGHT 352+50
//Ipad  竖屏
#define IPAD_PORTRAIT_KEYBOARD_HEIGHT 264+50

#define TEXTFIELD_KEYBOARD_DISTANCE 100

#ifdef DEBUG
//#  define DLog(fmt, ...) do { NSString* file = [[NSString alloc] initWithFormat:@"%s", __FILE__]; NSLog((@"%@(%d) " fmt), [file lastPathComponent], __LINE__, ##__VA_ARGS__); [file release]; } while(0)
#  define DLog(fmt, ...) do { NSString* file = [[NSString alloc] initWithFormat:@"%s", __FILE__]; NSLog((@"%@(%d) " fmt), [file lastPathComponent], __LINE__, ##__VA_ARGS__);  } while(0)
#  define DLog_METHOD NSLog(@"%s", __func__)
#  define DLog_CMETHOD NSLog(@"%@/%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd))
#  define COUNT(p) NSLog(@"%s(%d): count = %d/n", __func__, __LINE__, [p retainCount]);
#  define DLog_TRACE(x) do {printf x; putchar('/n'); fflush(stdout);} while (0)
#else
#  define DLog(...)
#  define DLog_METHOD
#  define DLog_CMETHOD
#  define COUNT(p)
#  define DLog_TRACE(x)
#endif
//身份证返回

#define server_return_Data @"resultData"
#define server_return_Code @"code"
#define server_return_SusseccCode 0
#define server_return_Info @"resultMessage"
#define server_return_Status @"Status"
#define server_return_Message @"message"

//  COMMON COLOR(颜色值)

//customer navBar background color
#define CustomNavBarBackgroundColor COLORHEX(@"3F4456")
//APP background color
#define AppBackGroundColor [UIColor colorWithRed:245/255.0 green:244/255.0 blue:244/255.0 alpha:1]

//黄色
#define yellow_colour [UIColor colorWithRed:236/255.0 green:218/255.0 blue:43/255.0 alpha:1]

//黄色
#define button_black_colour [UIColor colorWithRed:3/255.0 green:3/255.0 blue:3/255.0 alpha:1]

//蓝色
#define blue_colour [UIColor colorWithRed:18/255.0 green:146/255.0 blue:254/255.0 alpha:1]
//  颜色
#define UICOLOR_HEX(hexColor) \
[UIColor colorWithRed: (((hexColor >> 16) & 0xFF)) / 255.0f green: (((hexColor >> 8) & 0xFF)) / 255.0f blue: ((hexColor & 0xFF)) / 255.0f alpha:1.0f]

#define SDColor(r, g, b, a) [UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:a]

#define Global_tintColor [UIColor colorWithRed:0 green:(190 / 255.0) blue:(12 / 255.0) alpha:1]

#define Global_mainBackgroundColor SDColor(248, 248, 248, 1)

#define TimeLineCellHighlightedColor [UIColor colorWithRed:92/255.0 green:140/255.0 blue:193/255.0 alpha:1.0]
#define COLORHEX(a) [HEXColor getColor:a]
#define BACKGROUNDCOLOR         COLORHEX(@"3F4456")

#define CLASS_NAME(Class) NSStringFromClass([Class class])
#define STR(a)  [NSString stringWithFormat:@"%@", (a)]
#define STR_INT(a)  [NSString stringWithFormat:@"%d", (a)]
#define STR_LONG(a)  [NSString stringWithFormat:@"%ld", (a)]
#define STR_NUM2(a)  [NSString stringWithFormat:@"%.2f", (a)]
#define STR_NUM0(a)  [NSString stringWithFormat:@"%.0f", (a)]

//   COMMON STRING

#define HLUUID               [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]


typedef dispatch_block_t BlockVoidType;
typedef void (^BlockIdType)(id);

//  注册返回的参数
#define HLAge                     @"HLage"//年龄
#define HLID                      @"HLid"//ID
#define HLNickName                @"HLnickName"//名称
#define HLGender                  @"HLgender"//性别
#define HLHeadPortrait            @"HLheadPortrait"//头像
#define HLUsertoken               @"HLtoken" //融云token
#define HLPhoneNo                 @"HLphoneNo"//手机号
#define HLNumber                  @"HLNumber"//火鹿账号
#define HLSelfLocation            @"HLSelfLocation"//当前定位皮肤
#define HLSkinH                   @"HLSkinH"
#define HLSkinW                   @"HLSkinW"
#define HLMapZoom                 @"HLMapZoom"
#define HLOpenID                  @"HLOpenID"//openid
#define HLSelfVoice               @"HLSelfVoice"//当前录音文件
#define HLPublicKey               @"HLPublicKey" //公钥
#define HLTokens                  @"HLTokens"  //token
#define HLMQSendMeetMessage       @"huoluSL"
#define HLMQSendLocationMessage   @"huoluSRT"
#define HLMQSendChatMessage       @"huoluSOC"

//极光推送
#define HLTNotifi                @"HLTNotifi" //轨迹计数
#define HLOrbitCount             @"HLOrbitCount"//轨迹记录
#define HLOrbitCountNoti         @"HLOrbitCountNoti"//轨迹通知
#define HLOrbitCountReload       @"HLOrbitCountReload"//轨迹刷新
#define ReceiveRCNews            @"ReceiveRCNews"//收到融云聊天消息
#define HLLogout                 @"HLLogout"   //退出登录记录
#define HLMailNewFCount          @"HLMailNewFCount"//新的好友左上角记录
#define ReceiveMailNewsNoti      @"ReceiveMailNewsNoti"//新的好友通知
#define HLReceiveGift            @"HLReceiveGift"//收到礼物红点记录
#define HLReceiveGiftNoti        @"HLReceiveGiftNoti"//收到礼物通知
#define HLPersonSetupBlack       @"HLPersonSetupBlack"//拉黑点记录
#define HLPersonSetupBlackNoti   @"HLPersonSetupBlackNoti"//拉黑通知
#define HLPersonDeleteNoti       @"HLPersonDeleteNoti"//被删除通知
#define HLBlackReloadNoti        @"HLBlackReloadNoti"//拉黑点取消刷新
#define HLNewFriendReloadNoti    @"HLNewFriendReloadNoti"//新的好友点取消刷新
#define HLMoneyListSet           @"HLMoneyListSet"//账单红点记录
#define HLMoneyListNoti          @"HLMoneyListNoti"//账单变化通知
#define HLMoneyReloadNoti        @"HLMoneyReloadNoti"//账单取消变化通知
#define HLNewTrajectoryHead      @"HLNewTrajectoryHead"//新轨迹
#define HLNoNetWork              @"HLNoNetWork"//没网l记录
#define HLNoNetWorkNoti          @"HLNoNetWorkNoti"//没网通知


#endif

